<?php
/**
 * @copyright   Copyright (c) 2017 https://www.sapixx.com All rights reserved.
 * @license     Licensed (http://www.apache.org/licenses/LICENSE-2.0).
 * @author      pillar<ltmn@qq.com>
 * 商品分类
 */
namespace app\bestbao\validate;
use think\Validate;

class Product extends Validate{

    protected $rule = [
        'token'       => 'require|max:25|token',
        'id'          => 'require|number',
        'sort'        => 'require|number',
        'code'        => 'require',
        'category_id' => 'require|number|>:0',
        'title'       => 'require',
        'note'        => 'require',
    ];

    protected $message = [
        'id'          => 'ID丢失',
        'sort'        => '排序序号必须填写',
        'code'        => '产品名称必须填写',
        'category_id' => '产品栏目必须选择',
        'title'       => '产品名称必须填写',
        'note'        => '产品描述必须填写',
    ];

    protected $scene = [
        'sort' => ['id','sort'],
        'edit' => ['category_id','title','name'],
    ];
}